package org.jeecg.enums.meter;

public enum MeterCallBackTypeEnum {
    METER_CALL_BACK_TYPE_1(1, "缴费充值"),
    METER_CALL_BACK_TYPE_2(2, "通断状态控制"),
    METER_CALL_BACK_TYPE_3(3, "通断模式控制"),
    METER_CALL_BACK_TYPE_4(4, "修改单价");

    private Integer code;
    private String desc;

    MeterCallBackTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        MeterCallBackTypeEnum[] enums = values();
        for (MeterCallBackTypeEnum typeEnum : enums) {
            if (value.intValue() == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        MeterCallBackTypeEnum[] enums = values();
        for (MeterCallBackTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
